//
//  MainTableViewCell.m
//  LiangYa_BObject
//
//  Created by dllo on 15/10/28.
//  Copyright © 2015年 YuHao. All rights reserved.
//

#import "MainTableViewCell.h"


@implementation MainTableViewCell

- (void)drawRect:(CGRect)rect
{
    CGContextRef context = UIGraphicsGetCurrentContext();
    
    CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);
    CGContextFillRect(context, rect);
    
    //下分割线
    CGContextSetStrokeColorWithColor(context, [UIColor colorWithRed:52/225. green:143/225. blue:110/225. alpha:1.].CGColor);
    CGContextStrokeRect(context, CGRectMake(10, rect.size.height, rect.size.width - 20, 1));
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
//        self.myimgageview = [[UIImageView alloc] init];
//        [self.contentView addSubview:self.myimgageview];
//        self.myimgageview.layer.cornerRadius = 10;
//        self.myimgageview.layer.masksToBounds = YES;
//        self.myimgageview.image = [UIImage imageNamed:@"back1"];
        
        
        
        
        self.myimgageview1 = [[UIImageView alloc] init];
//        self.myimgageview1.layer.cornerRadius = 10;
//        self.myimgageview1.layer.masksToBounds = YES;
        [self.contentView addSubview:self.myimgageview1];
        
        self.mylabel = [[NightLabel alloc] init];
        [self.contentView addSubview:self.mylabel];
        self.mylabel.numberOfLines = 0;
        [self.mylabel sizeToFit];
        
        self.mylabel1 = [[UILabel alloc] init];
        [self.contentView addSubview:self.mylabel1];
        self.mylabel1.font = [UIFont systemFontOfSize:14];
        self.mylabel1.textColor = [UIColor redColor];
        
        self.mylabel2 = [[GrayLabel alloc] init];
        [self.contentView addSubview:self.mylabel2];
//        self.mylabel2.textColor = [UIColor grayColor];
        self.mylabel2.font = [UIFont systemFontOfSize:14];
        
    }
    
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
     self.backgroundColor = [UIColor clearColor];
    self.myimgageview.frame = CGRectMake(0, 5, cellWidth , cellHeight - 10);
    self.myimgageview1.frame = CGRectMake(10, 5, cellWidth/2-30, cellHeight - 20);
    
    self.mylabel.frame = CGRectMake(cellWidth/2-10, 5, cellWidth/2, cellHeight*2/3);
    self.mylabel1.frame = CGRectMake(cellWidth/2- 5, cellHeight*3/4, cellWidth/5, 30);
    self.mylabel2.frame = CGRectMake(cellWidth/2 + 70, cellHeight*3/4, cellWidth/2 - 80, 30);
    
    if ([[NSUserDefaults standardUserDefaults]boolForKey:@"nightstyle"]) {
        _mylabel.textColor = [UIColor whiteColor];
        _mylabel2.textColor = [UIColor whiteColor];
    }else{
        _mylabel2.textColor = [UIColor grayColor];
        _mylabel.textColor = [UIColor blackColor];
    }
}






- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
